var commonData = require("../Common/commonData.js");
/**
 * roomAppService.js
 * 房间数据服务appService服务方法
 */

var appservice = {

  /**
   * 请求
   */
  requestGetHead: function(method, data, callback, fail) {
    var head = commonData.appRequestHeadData(1, method);
    head.success = callback;
    head.fail = fail;
    head.data = data;
    wx.request(head);
  },

  /**
   * 获取房间信息
   */
  GetRoomList: function(CstGuid, callback) {
    var obj = this.requestGetHead("GetRoomList","'" + CstGuid + "'",
      function(roomInfo) {    
        callback(roomInfo.data);
      },
      function(data) {
        //失败返回测试数据
        callback([{
            roomname: "XX项目-XX小区-1栋-101",
            zygwName: "小磊哥哥",
            zygwTel: "12345678911",
            auditstatus: 0,
          },
          {
            roomname: "XX项目-XX小区-12栋-103",
            zygwName: "雷哥哥",
            zygwTel: "12345678911",
            auditstatus: 1,
          }
        ]);
      }
    );
  }
}

module.exports = appservice;